package qnb.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import qnb.dao.StudentDao;
import qnb.dao.TeacherDao;
import qnb.entity.Student;
import qnb.entity.Teacher;
import qnb.service.TeacherServiceDao;

@Service
public class TeacherServiceDaoImp implements TeacherServiceDao {
	@Autowired
	private TeacherDao dao;

	@Autowired
	private StudentDao studentDao;

	@Override
	public int addTeacher(Teacher teacher) {
		// TODO Auto-generated method stub
		return dao.addTeacher(teacher);
	}

	@Override
	public int updateTeacher(Teacher teacher) {
		// TODO Auto-generated method stub
		return dao.updateTeacher(teacher);
	}

	@Override
	public int deleteTeacher(String[] teacherId) {
		// TODO Auto-generated method stub
		return dao.deleteTeacher(teacherId);
	}

	@Override
	public List<Teacher> selectForPage(String style, String teacherName, int page, int pageSize) {
		// TODO Auto-generated method stub
		return dao.selectForPage(style, teacherName, page, pageSize);
	}

	@Override
	public List<Teacher> selectAll() {
		// TODO Auto-generated method stub
		return dao.selectAll();
	}

	@Override
	public Teacher selectOne(String teacherId) {
		// TODO Auto-generated method stub
		return dao.selectOne(teacherId);
	}

	@Override
	public int selectCount() {
		// TODO Auto-generated method stub
		return dao.selectCount();
	}

	/**
	 * 判断账号是否重复
	 */
	@Override
	public int checkAccount(String account) {
		int count = studentDao.selectOneForAccount(account);
		if (count>0){
			return count;
		}
		return dao.checkAccount(account);
	}

	@Override
	public int addExcelData(List<Teacher> list) {
		// TODO Auto-generated method stub
		return dao.addExcelData(list);
	}

	@Override
	public List<Teacher> checkExcel(List<String> id) {
		// TODO Auto-generated method stub
		return dao.checkExcel(id);
	}

	@Override
	public List<Teacher> checkExcel2(List<String> teacherAccount) {
		// TODO Auto-generated method stub
		return dao.checkExcel2(teacherAccount);
	}

	@Override
	public Teacher checkLogin(String account, String password) {
		// TODO Auto-generated method stub
		return dao.checkLogin(account, password);
	}

	@Override
	public int checkId(String id) {
		return dao.checkId(id);
	}

	@Override
	public int updatePassword(String account, String password) {
		// TODO Auto-generated method stub
		return dao.updatePassword(account, password);
	}

}
